package com.example.demo.service;

import com.example.demo.mapper.UserMapper;
import com.example.demo.model.UserInfo;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * @author 郝文雪
 * @date 2022/8/4 9:23
 * @Description Test
 */
@Service
public class UserService {
    @Resource
    private UserMapper userMapper;

    @Transactional(propagation = Propagation.NESTED)
    public int add(UserInfo userInfo) throws InterruptedException {
        Thread.sleep(1000*3);
        return userMapper.add(userInfo);
    }
}
